#桶排序
def bucket_sort(arr):
    pre_lst = [0]*max(arr)
    res = []
    for a in arr:
        pre_lst[a-1] += 1
    i = 0
    while i < len(pre_lst):
        j = 0
        while j < pre_lst[i]:
            res.append(i+1)
            j += 1
        i += 1
    return res
print(bucket_sort([5,5,5,2,3,8,1]))
